"""
the song class
"""
import simplejson
import urllib

class Search():
    def __init__(self,keyword=None):
        if keyword is not None:
            self.keyword = keyword

    def getFisrtSong(self):
        """
        check whether the song is right using edit distance
        01</td>(\s|\S)*?</a>
        """


class Song():
    #the init part
    def __init__(self,id=None):
        if id is not None:
            self.id = id

    def getDownLoadUrl(self):
        #pageurl = "http://i.kuwo.cn/US/mbmusic2?id="+self.id+"&op=iphone2"
        pageurl = "http://i.kuwo.cn/US/mbmusicRes?id="+str(self.id)
        content = urllib.urlopen(pageurl).read()
        jsonobj = simplejson.loads(content)
        print jsonobj
        return jsonobj['inf']

if __name__ == "__main__":
    s = Song("201924")
    print s.getDownLoadUrl()
